#pragma once
#include <sys/shm.h>
#include <string>
#include<cstdlib>
#include <cstring>
#include <cerrno>
#include <unistd.h>
#include <iostream>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
using namespace std;

const string pathname = "/home/cr/git/linux/test_2_24";
const int proj_id = 20040712;
int size = 4096;

std::string ToHex(int id)
{
    char buffer[1024];
    snprintf(buffer, sizeof(buffer), "0x%x", id);
    return buffer;
}
key_t getkey()
{
    key_t key = ftok(pathname.c_str(), proj_id);
    if (key == -1)
    {
        cout << "errno = " << errno << ",strerrno = " << strerror(errno) << endl;
        exit(1);
    }
    return key;
}

